This has been dangling ever since 3.0.
<xi:include href="xml/gtkcontainer.xml" />
<xi:include href="xml/gtkbin.xml" />
<xi:include href="xml/gtkmenushell.xml" />
- <xi:include href="xml/gtkmisc.xml" />
<xi:include href="xml/gtkrange.xml" />
<xi:include href="xml/gtkimcontext.xml" />
</chapter>
<xi:include href="xml/gtkrecentaction.xml" />
<xi:include href="xml/gtkactivatable.xml" />
<xi:include href="xml/gtkimagemenuitem.xml" />
+ <xi:include href="xml/gtkmisc.xml" />
<xi:include href="xml/gtkstock.xml" />
<xi:include href="xml/gtkiconfactory.xml" />
<xi:include href="xml/gtknumerableicon.xml" />
deprecated/gtkhsv.h \
deprecated/gtkiconfactory.h \
deprecated/gtkimagemenuitem.h \
+ deprecated/gtkmisc.h \
deprecated/gtknumerableicon.h \
deprecated/gtkradioaction.h \
deprecated/gtkrc.h \
gtkmenushell.h \
gtkmenutoolbutton.h \
gtkmessagedialog.h \
- gtkmisc.h \
gtkmodules.h \
gtkmountoperation.h \
gtknotebook.h \
deprecated/gtkhsv.c \
deprecated/gtkiconfactory.c \
deprecated/gtkimagemenuitem.c \
+ deprecated/gtkmisc.c \
deprecated/gtknumerableicon.c \
deprecated/gtkradioaction.c \
deprecated/gtkrc.c \
gtkmenutrackeritem.c \
gtkmenutoolbutton.c \
gtkmessagedialog.c \
- gtkmisc.c \
gtkmnemonichash.c \
gtkmodelmenuitem.c \
gtkmodelbutton.c \
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+#include "gtkcontainer.h"
+#include "gtkmisc.h"
+#include "gtkintl.h"
+#include "gtkprivate.h"
+
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
+/**
+ * SECTION:gtkmisc
+ * @Short_description: Base class for widgets with alignments and padding
+ * @Title: GtkMisc
+ *
+ * The #GtkMisc widget is an abstract widget which is not useful itself, but
+ * is used to derive subclasses which have alignment and padding attributes.
+ *
+ * The horizontal and vertical padding attributes allows extra space to be
+ * added around the widget.
+ *
+ * The horizontal and vertical alignment attributes enable the widget to be
+ * positioned within its allocated area. Note that if the widget is added to
+ * a container in such a way that it expands automatically to fill its
+ * allocated area, the alignment settings will not alter the widgets position.
+ *
+ * Note that the desired effect can in most cases be achieved by using the
+ * #GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties
+ * on the child widget, so GtkMisc should not be used in new code. To reflect
+ * this fact, all #GtkMisc API has been deprecated.
+ */
+
+struct _GtkMiscPrivate
+{
+ gfloat xalign;
+ gfloat yalign;
+
+ guint16 xpad;
+ guint16 ypad;
+};
+
+enum {
+ PROP_0,
+ PROP_XALIGN,
+ PROP_YALIGN,
+ PROP_XPAD,
+ PROP_YPAD
+};
+
+static void gtk_misc_realize (GtkWidget *widget);
+static void gtk_misc_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gtk_misc_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkMisc, gtk_misc, GTK_TYPE_WIDGET)
+
+static void
+gtk_misc_class_init (GtkMiscClass *class)
+{
+ GObjectClass *gobject_class;
+ GtkWidgetClass *widget_class;
+
+ gobject_class = G_OBJECT_CLASS (class);
+ widget_class = (GtkWidgetClass*) class;
+
+ gobject_class->set_property = gtk_misc_set_property;
+ gobject_class->get_property = gtk_misc_get_property;
+
+ widget_class->realize = gtk_misc_realize;
+
+ g_object_class_install_property (gobject_class,
+ PROP_XALIGN,
+ g_param_spec_float ("xalign",
+ P_("X align"),
+ P_("The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts."),
+ 0.0,
+ 1.0,
+ 0.5,
+ GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
+
+ g_object_class_install_property (gobject_class,
+ PROP_YALIGN,
+ g_param_spec_float ("yalign",
+ P_("Y align"),
+ P_("The vertical alignment, from 0 (top) to 1 (bottom)"),
+ 0.0,
+ 1.0,
+ 0.5,
+ GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
+
+ g_object_class_install_property (gobject_class,
+ PROP_XPAD,
+ g_param_spec_int ("xpad",
+ P_("X pad"),
+ P_("The amount of space to add on the left and right of the widget, in pixels"),
+ 0,
+ G_MAXINT,
+ 0,
+ GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
+
+ g_object_class_install_property (gobject_class,
+ PROP_YPAD,
+ g_param_spec_int ("ypad",
+ P_("Y pad"),
+ P_("The amount of space to add on the top and bottom of the widget, in pixels"),
+ 0,
+ G_MAXINT,
+ 0,
+ GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
+}
+
+static void
+gtk_misc_init (GtkMisc *misc)
+{
+ GtkMiscPrivate *priv;
+
+ misc->priv = gtk_misc_get_instance_private (misc);
+ priv = misc->priv;
+
+ priv->xalign = 0.5;
+ priv->yalign = 0.5;
+ priv->xpad = 0;
+ priv->ypad = 0;
+}
+
+static void
+gtk_misc_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkMisc *misc = GTK_MISC (object);
+ GtkMiscPrivate *priv = misc->priv;
+
+ switch (prop_id)
+ {
+ case PROP_XALIGN:
+ gtk_misc_set_alignment (misc, g_value_get_float (value), priv->yalign);
+ break;
+ case PROP_YALIGN:
+ gtk_misc_set_alignment (misc, priv->xalign, g_value_get_float (value));
+ break;
+ case PROP_XPAD:
+ gtk_misc_set_padding (misc, g_value_get_int (value), priv->ypad);
+ break;
+ case PROP_YPAD:
+ gtk_misc_set_padding (misc, priv->xpad, g_value_get_int (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_misc_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkMisc *misc = GTK_MISC (object);
+ GtkMiscPrivate *priv = misc->priv;
+
+ switch (prop_id)
+ {
+ case PROP_XALIGN:
+ g_value_set_float (value, priv->xalign);
+ break;
+ case PROP_YALIGN:
+ g_value_set_float (value, priv->yalign);
+ break;
+ case PROP_XPAD:
+ g_value_set_int (value, priv->xpad);
+ break;
+ case PROP_YPAD:
+ g_value_set_int (value, priv->ypad);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/**
+ * gtk_misc_set_alignment:
+ * @misc: a #GtkMisc.
+ * @xalign: the horizontal alignment, from 0 (left) to 1 (right).
+ * @yalign: the vertical alignment, from 0 (top) to 1 (bottom).
+ *
+ * Sets the alignment of the widget.
+ *
+ * Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
+ */
+void
+gtk_misc_set_alignment (GtkMisc *misc,
+ gfloat xalign,
+ gfloat yalign)
+{
+ GtkMiscPrivate *priv;
+ GtkWidget *widget;
+
+ g_return_if_fail (GTK_IS_MISC (misc));
+
+ priv = misc->priv;
+
+ if (xalign < 0.0)
+ xalign = 0.0;
+ else if (xalign > 1.0)
+ xalign = 1.0;
+
+ if (yalign < 0.0)
+ yalign = 0.0;
+ else if (yalign > 1.0)
+ yalign = 1.0;
+
+ if ((xalign != priv->xalign) || (yalign != priv->yalign))
+ {
+ g_object_freeze_notify (G_OBJECT (misc));
+ if (xalign != priv->xalign)
+ g_object_notify (G_OBJECT (misc), "xalign");
+
+ if (yalign != priv->yalign)
+ g_object_notify (G_OBJECT (misc), "yalign");
+
+ priv->xalign = xalign;
+ priv->yalign = yalign;
+
+ /* clear the area that was allocated before the change
+ */
+ widget = GTK_WIDGET (misc);
+ if (gtk_widget_is_drawable (widget))
+ gtk_widget_queue_draw (widget);
+
+ g_object_thaw_notify (G_OBJECT (misc));
+ }
+}
+
+/**
+ * gtk_misc_get_alignment:
+ * @misc: a #GtkMisc
+ * @xalign: (out) (allow-none): location to store X alignment of @misc, or %NULL
+ * @yalign: (out) (allow-none): location to store Y alignment of @misc, or %NULL
+ *
+ * Gets the X and Y alignment of the widget within its allocation.
+ * See gtk_misc_set_alignment().
+ *
+ * Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
+ **/
+void
+gtk_misc_get_alignment (GtkMisc *misc,
+ gfloat *xalign,
+ gfloat *yalign)
+{
+ GtkMiscPrivate *priv;
+
+ g_return_if_fail (GTK_IS_MISC (misc));
+
+ priv = misc->priv;
+
+ if (xalign)
+ *xalign = priv->xalign;
+ if (yalign)
+ *yalign = priv->yalign;
+}
+
+/**
+ * gtk_misc_set_padding:
+ * @misc: a #GtkMisc.
+ * @xpad: the amount of space to add on the left and right of the widget,
+ * in pixels.
+ * @ypad: the amount of space to add on the top and bottom of the widget,
+ * in pixels.
+ *
+ * Sets the amount of space to add around the widget.
+ *
+ * Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
+ */
+void
+gtk_misc_set_padding (GtkMisc *misc,
+ gint xpad,
+ gint ypad)
+{
+ GtkMiscPrivate *priv;
+
+ g_return_if_fail (GTK_IS_MISC (misc));
+
+ priv = misc->priv;
+
+ if (xpad < 0)
+ xpad = 0;
+ if (ypad < 0)
+ ypad = 0;
+
+ if ((xpad != priv->xpad) || (ypad != priv->ypad))
+ {
+ g_object_freeze_notify (G_OBJECT (misc));
+ if (xpad != priv->xpad)
+ g_object_notify (G_OBJECT (misc), "xpad");
+
+ if (ypad != priv->ypad)
+ g_object_notify (G_OBJECT (misc), "ypad");
+
+ priv->xpad = xpad;
+ priv->ypad = ypad;
+
+ if (gtk_widget_is_drawable (GTK_WIDGET (misc)))
+ gtk_widget_queue_resize (GTK_WIDGET (misc));
+
+ g_object_thaw_notify (G_OBJECT (misc));
+ }
+}
+
+/**
+ * gtk_misc_get_padding:
+ * @misc: a #GtkMisc
+ * @xpad: (out) (allow-none): location to store padding in the X
+ * direction, or %NULL
+ * @ypad: (out) (allow-none): location to store padding in the Y
+ * direction, or %NULL
+ *
+ * Gets the padding in the X and Y directions of the widget.
+ * See gtk_misc_set_padding().
+ *
+ * Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
+ **/
+void
+gtk_misc_get_padding (GtkMisc *misc,
+ gint *xpad,
+ gint *ypad)
+{
+ GtkMiscPrivate *priv;
+
+ g_return_if_fail (GTK_IS_MISC (misc));
+
+ priv = misc->priv;
+
+ if (xpad)
+ *xpad = priv->xpad;
+ if (ypad)
+ *ypad = priv->ypad;
+}
+
+static void
+gtk_misc_realize (GtkWidget *widget)
+{
+ GtkAllocation allocation;
+ GdkWindow *window;
+ GdkWindowAttr attributes;
+ gint attributes_mask;
+
+ gtk_widget_set_realized (widget, TRUE);
+
+ if (!gtk_widget_get_has_window (widget))
+ {
+ window = gtk_widget_get_parent_window (widget);
+ gtk_widget_set_window (widget, window);
+ g_object_ref (window);
+ }
+ else
+ {
+ gtk_widget_get_allocation (widget, &allocation);
+
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
+
+ window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gtk_widget_register_window (widget, window);
+ gdk_window_set_background_pattern (window, NULL);
+ }
+}
+
+/* Semi-private function used by gtk widgets inheriting from
+ * GtkMisc that takes into account both css padding and border
+ * and the padding specified with the GtkMisc properties.
+ */
+void
+_gtk_misc_get_padding_and_border (GtkMisc *misc,
+ GtkBorder *border)
+{
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder tmp;
+ gint xpad, ypad;
+
+ g_return_if_fail (GTK_IS_MISC (misc));
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (misc));
+ state = gtk_widget_get_state_flags (GTK_WIDGET (misc));
+
+ gtk_style_context_get_padding (context, state, border);
+
+ gtk_misc_get_padding (misc, &xpad, &ypad);
+ border->top += ypad;
+ border->left += xpad;
+ border->bottom += ypad;
+ border->right += xpad;
+
+ gtk_style_context_get_border (context, state, &tmp);
+ border->top += tmp.top;
+ border->right += tmp.right;
+ border->bottom += tmp.bottom;
+ border->left += tmp.left;
+}
+
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GTK_MISC_H__
+#define __GTK_MISC_H__
+
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#include <gtk/gtkwidget.h>
+
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_MISC (gtk_misc_get_type ())
+#define GTK_MISC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MISC, GtkMisc))
+#define GTK_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MISC, GtkMiscClass))
+#define GTK_IS_MISC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MISC))
+#define GTK_IS_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MISC))
+#define GTK_MISC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MISC, GtkMiscClass))
+
+
+typedef struct _GtkMisc GtkMisc;
+typedef struct _GtkMiscPrivate GtkMiscPrivate;
+typedef struct _GtkMiscClass GtkMiscClass;
+
+struct _GtkMisc
+{
+ GtkWidget widget;
+
+ /*< private >*/
+ GtkMiscPrivate *priv;
+};
+
+struct _GtkMiscClass
+{
+ GtkWidgetClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+GDK_DEPRECATED_IN_3_14
+GType gtk_misc_get_type (void) G_GNUC_CONST;
+GDK_DEPRECATED_IN_3_14
+void gtk_misc_set_alignment (GtkMisc *misc,
+ gfloat xalign,
+ gfloat yalign);
+GDK_DEPRECATED_IN_3_14
+void gtk_misc_get_alignment (GtkMisc *misc,
+ gfloat *xalign,
+ gfloat *yalign);
+GDK_DEPRECATED_IN_3_14
+void gtk_misc_set_padding (GtkMisc *misc,
+ gint xpad,
+ gint ypad);
+GDK_DEPRECATED_IN_3_14
+void gtk_misc_get_padding (GtkMisc *misc,
+ gint *xpad,
+ gint *ypad);
+
+void _gtk_misc_get_padding_and_border (GtkMisc *misc,
+ GtkBorder *border);
+
+G_END_DECLS
+
+#endif /* __GTK_MISC_H__ */
#include <gtk/gtkmenushell.h>
#include <gtk/gtkmenutoolbutton.h>
#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkmisc.h>
#include <gtk/gtkmodules.h>
#include <gtk/gtkmountoperation.h>
#include <gtk/gtknotebook.h>
#include <gtk/deprecated/gtkhseparator.h>
#include <gtk/deprecated/gtkiconfactory.h>
#include <gtk/deprecated/gtkimagemenuitem.h>
+#include <gtk/deprecated/gtkmisc.h>
#include <gtk/deprecated/gtknumerableicon.h>
#include <gtk/deprecated/gtkradioaction.h>
#include <gtk/deprecated/gtkrc.h>
cairo_restore (cr);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_misc_get_padding (misc, &xpad, NULL);
+G_GNUC_END_IGNORE_DEPRECATIONS
if (direction == GTK_TEXT_DIR_RTL)
x = xpad;
gint *minimum_size,
gint *natural_size);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DEFINE_TYPE_WITH_PRIVATE (GtkArrow, gtk_arrow, GTK_TYPE_MISC)
+G_GNUC_END_IGNORE_DEPRECATIONS
static void
gtk_arrow_class_init (GtkArrowClass *class)
{
GtkBorder border;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (widget), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
*minimum_size = MIN_ARROW_SIZE + border.left + border.right;
*natural_size = MIN_ARROW_SIZE + border.left + border.right;
{
GtkBorder border;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (widget), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
*minimum_size = MIN_ARROW_SIZE + border.top + border.bottom;
*natural_size = MIN_ARROW_SIZE + border.top + border.bottom;
context = gtk_widget_get_style_context (widget);
gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (widget), &border);
gtk_misc_get_alignment (GTK_MISC (widget), &xalign, &yalign);
+G_GNUC_END_IGNORE_DEPRECATIONS
width = gtk_widget_get_allocated_width (widget) - border.left - border.right;
height = gtk_widget_get_allocated_height (widget) - border.top - border.bottom;
#error "Only <gtk/gtk.h> can be included directly."
#endif
-#include <gtk/gtkmisc.h>
+#include <gtk/deprecated/gtkmisc.h>
G_BEGIN_DECLS
page_info->current_title = gtk_label_new (NULL);
gtk_widget_set_no_show_all (page_info->current_title, TRUE);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* Note: we need to use misc alignment here as long as GtkLabel
* pays attention to it. GtkWiget::halign is ineffective, since
* all the labels are getting the same size anyway, due to the
* size group.
*/
gtk_misc_set_alignment (GTK_MISC (page_info->regular_title), 0, 0.5);
- gtk_widget_show (page_info->regular_title);
-
gtk_misc_set_alignment (GTK_MISC (page_info->current_title), 0, 0.5);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+ gtk_widget_show (page_info->regular_title);
gtk_widget_hide (page_info->current_title);
context = gtk_widget_get_style_context (page_info->current_title);
{
GtkButtonPrivate *priv = button->priv;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GTK_IS_MISC (widget))
{
GtkMisc *misc = GTK_MISC (widget);
-
+
if (priv->align_set)
gtk_misc_set_alignment (misc, priv->xalign, priv->yalign);
}
priv->xalign, priv->yalign,
xscale, yscale);
}
+G_GNUC_END_IGNORE_DEPRECATIONS
}
static void
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (priv->align_set)
gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
+G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (button), label);
PROP_USE_FALLBACK
};
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DEFINE_TYPE_WITH_PRIVATE (GtkImage, gtk_image, GTK_TYPE_MISC)
+G_GNUC_END_IGNORE_DEPRECATIONS
static void
gtk_image_class_init (GtkImageClass *class)
context = gtk_widget_get_style_context (GTK_WIDGET (image));
_gtk_icon_helper_get_size (priv->icon_helper, context, &width, &height);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (image), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
width += border.left + border.right;
height += border.top + border.bottom;
{
GtkImage *image;
GtkImagePrivate *priv;
- GtkMisc *misc;
GtkStyleContext *context;
gint x, y, width, height, baseline;
gfloat xalign, yalign;
g_return_val_if_fail (GTK_IS_IMAGE (widget), FALSE);
image = GTK_IMAGE (widget);
- misc = GTK_MISC (image);
priv = image->priv;
context = gtk_widget_get_style_context (widget);
0, 0,
gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget));
- gtk_misc_get_alignment (misc, &xalign, &yalign);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ gtk_misc_get_alignment (GTK_MISC (image), &xalign, &yalign);
+ _gtk_misc_get_padding_and_border (GTK_MISC (image), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
gtk_image_get_preferred_size (image, &width, &height);
- _gtk_misc_get_padding_and_border (misc, &border);
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
xalign = 1.0 - xalign;
#endif
#include <gio/gio.h>
-#include <gtk/gtkmisc.h>
+#include <gtk/deprecated/gtkmisc.h>
G_BEGIN_DECLS
static GtkBuildableIface *buildable_parent_iface = NULL;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DEFINE_TYPE_WITH_CODE (GtkLabel, gtk_label, GTK_TYPE_MISC,
G_ADD_PRIVATE (GtkLabel)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_label_buildable_interface_init))
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+ gtk_label_buildable_interface_init))
+G_GNUC_END_IGNORE_DEPRECATIONS
static void
add_move_binding (GtkBindingSet *binding_set,
PangoRectangle logical;
gint width, height;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
width = gtk_widget_get_allocated_width (GTK_WIDGET (label)) - border.left - border.right;
height = gtk_widget_get_allocated_height (GTK_WIDGET (label)) - border.top - border.bottom;
smallest_rect.width = PANGO_PIXELS_CEIL (smallest_rect.width);
smallest_rect.height = PANGO_PIXELS_CEIL (smallest_rect.height);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
{
GtkBorder border;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
if (priv->wrap)
gtk_label_clear_layout (label);
{
GtkBorder border;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
if (priv->wrap)
gtk_label_clear_layout (label);
gint *yp)
{
GtkAllocation allocation;
- GtkMisc *misc;
GtkWidget *widget;
GtkLabelPrivate *priv;
GtkBorder border;
PangoRectangle logical;
gint baseline, layout_baseline, baseline_offset;
- misc = GTK_MISC (label);
widget = GTK_WIDGET (label);
priv = label->priv;
- gtk_misc_get_alignment (misc, &xalign, &yalign);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ gtk_misc_get_alignment (GTK_MISC (label), &xalign, &yalign);
_gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
+G_GNUC_END_IGNORE_DEPRECATIONS
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
xalign = 1.0 - xalign;
#error "Only <gtk/gtk.h> can be included directly."
#endif
-#include <gtk/gtkmisc.h>
+#include <gtk/deprecated/gtkmisc.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkmenu.h>
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-#include "gtkcontainer.h"
-#include "gtkmisc.h"
-#include "gtkintl.h"
-#include "gtkprivate.h"
-
-
-/**
- * SECTION:gtkmisc
- * @Short_description: Base class for widgets with alignments and padding
- * @Title: GtkMisc
- *
- * The #GtkMisc widget is an abstract widget which is not useful itself, but
- * is used to derive subclasses which have alignment and padding attributes.
- *
- * The horizontal and vertical padding attributes allows extra space to be
- * added around the widget.
- *
- * The horizontal and vertical alignment attributes enable the widget to be
- * positioned within its allocated area. Note that if the widget is added to
- * a container in such a way that it expands automatically to fill its
- * allocated area, the alignment settings will not alter the widgets position.
- *
- * Note that the desired effect can in most cases be achieved by using the
- * #GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties
- * on the child widget, so GtkMisc should not be used in new code.
- */
-
-
-struct _GtkMiscPrivate
-{
- gfloat xalign;
- gfloat yalign;
-
- guint16 xpad;
- guint16 ypad;
-};
-
-enum {
- PROP_0,
- PROP_XALIGN,
- PROP_YALIGN,
- PROP_XPAD,
- PROP_YPAD
-};
-
-static void gtk_misc_realize (GtkWidget *widget);
-static void gtk_misc_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gtk_misc_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkMisc, gtk_misc, GTK_TYPE_WIDGET)
-
-static void
-gtk_misc_class_init (GtkMiscClass *class)
-{
- GObjectClass *gobject_class;
- GtkWidgetClass *widget_class;
-
- gobject_class = G_OBJECT_CLASS (class);
- widget_class = (GtkWidgetClass*) class;
-
- gobject_class->set_property = gtk_misc_set_property;
- gobject_class->get_property = gtk_misc_get_property;
-
- widget_class->realize = gtk_misc_realize;
-
- g_object_class_install_property (gobject_class,
- PROP_XALIGN,
- g_param_spec_float ("xalign",
- P_("X align"),
- P_("The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts."),
- 0.0,
- 1.0,
- 0.5,
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_YALIGN,
- g_param_spec_float ("yalign",
- P_("Y align"),
- P_("The vertical alignment, from 0 (top) to 1 (bottom)"),
- 0.0,
- 1.0,
- 0.5,
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_XPAD,
- g_param_spec_int ("xpad",
- P_("X pad"),
- P_("The amount of space to add on the left and right of the widget, in pixels"),
- 0,
- G_MAXINT,
- 0,
- GTK_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_YPAD,
- g_param_spec_int ("ypad",
- P_("Y pad"),
- P_("The amount of space to add on the top and bottom of the widget, in pixels"),
- 0,
- G_MAXINT,
- 0,
- GTK_PARAM_READWRITE));
-}
-
-static void
-gtk_misc_init (GtkMisc *misc)
-{
- GtkMiscPrivate *priv;
-
- misc->priv = gtk_misc_get_instance_private (misc);
- priv = misc->priv;
-
- priv->xalign = 0.5;
- priv->yalign = 0.5;
- priv->xpad = 0;
- priv->ypad = 0;
-}
-
-static void
-gtk_misc_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GtkMisc *misc = GTK_MISC (object);
- GtkMiscPrivate *priv = misc->priv;
-
- switch (prop_id)
- {
- case PROP_XALIGN:
- gtk_misc_set_alignment (misc, g_value_get_float (value), priv->yalign);
- break;
- case PROP_YALIGN:
- gtk_misc_set_alignment (misc, priv->xalign, g_value_get_float (value));
- break;
- case PROP_XPAD:
- gtk_misc_set_padding (misc, g_value_get_int (value), priv->ypad);
- break;
- case PROP_YPAD:
- gtk_misc_set_padding (misc, priv->xpad, g_value_get_int (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gtk_misc_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtkMisc *misc = GTK_MISC (object);
- GtkMiscPrivate *priv = misc->priv;
-
- switch (prop_id)
- {
- case PROP_XALIGN:
- g_value_set_float (value, priv->xalign);
- break;
- case PROP_YALIGN:
- g_value_set_float (value, priv->yalign);
- break;
- case PROP_XPAD:
- g_value_set_int (value, priv->xpad);
- break;
- case PROP_YPAD:
- g_value_set_int (value, priv->ypad);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * gtk_misc_set_alignment:
- * @misc: a #GtkMisc.
- * @xalign: the horizontal alignment, from 0 (left) to 1 (right).
- * @yalign: the vertical alignment, from 0 (top) to 1 (bottom).
- *
- * Sets the alignment of the widget.
- */
-void
-gtk_misc_set_alignment (GtkMisc *misc,
- gfloat xalign,
- gfloat yalign)
-{
- GtkMiscPrivate *priv;
- GtkWidget *widget;
-
- g_return_if_fail (GTK_IS_MISC (misc));
-
- priv = misc->priv;
-
- if (xalign < 0.0)
- xalign = 0.0;
- else if (xalign > 1.0)
- xalign = 1.0;
-
- if (yalign < 0.0)
- yalign = 0.0;
- else if (yalign > 1.0)
- yalign = 1.0;
-
- if ((xalign != priv->xalign) || (yalign != priv->yalign))
- {
- g_object_freeze_notify (G_OBJECT (misc));
- if (xalign != priv->xalign)
- g_object_notify (G_OBJECT (misc), "xalign");
-
- if (yalign != priv->yalign)
- g_object_notify (G_OBJECT (misc), "yalign");
-
- priv->xalign = xalign;
- priv->yalign = yalign;
-
- /* clear the area that was allocated before the change
- */
- widget = GTK_WIDGET (misc);
- if (gtk_widget_is_drawable (widget))
- gtk_widget_queue_draw (widget);
-
- g_object_thaw_notify (G_OBJECT (misc));
- }
-}
-
-/**
- * gtk_misc_get_alignment:
- * @misc: a #GtkMisc
- * @xalign: (out) (allow-none): location to store X alignment of @misc, or %NULL
- * @yalign: (out) (allow-none): location to store Y alignment of @misc, or %NULL
- *
- * Gets the X and Y alignment of the widget within its allocation.
- * See gtk_misc_set_alignment().
- **/
-void
-gtk_misc_get_alignment (GtkMisc *misc,
- gfloat *xalign,
- gfloat *yalign)
-{
- GtkMiscPrivate *priv;
-
- g_return_if_fail (GTK_IS_MISC (misc));
-
- priv = misc->priv;
-
- if (xalign)
- *xalign = priv->xalign;
- if (yalign)
- *yalign = priv->yalign;
-}
-
-/**
- * gtk_misc_set_padding:
- * @misc: a #GtkMisc.
- * @xpad: the amount of space to add on the left and right of the widget,
- * in pixels.
- * @ypad: the amount of space to add on the top and bottom of the widget,
- * in pixels.
- *
- * Sets the amount of space to add around the widget.
- */
-void
-gtk_misc_set_padding (GtkMisc *misc,
- gint xpad,
- gint ypad)
-{
- GtkMiscPrivate *priv;
-
- g_return_if_fail (GTK_IS_MISC (misc));
-
- priv = misc->priv;
-
- if (xpad < 0)
- xpad = 0;
- if (ypad < 0)
- ypad = 0;
-
- if ((xpad != priv->xpad) || (ypad != priv->ypad))
- {
- g_object_freeze_notify (G_OBJECT (misc));
- if (xpad != priv->xpad)
- g_object_notify (G_OBJECT (misc), "xpad");
-
- if (ypad != priv->ypad)
- g_object_notify (G_OBJECT (misc), "ypad");
-
- priv->xpad = xpad;
- priv->ypad = ypad;
-
- if (gtk_widget_is_drawable (GTK_WIDGET (misc)))
- gtk_widget_queue_resize (GTK_WIDGET (misc));
-
- g_object_thaw_notify (G_OBJECT (misc));
- }
-}
-
-/**
- * gtk_misc_get_padding:
- * @misc: a #GtkMisc
- * @xpad: (out) (allow-none): location to store padding in the X
- * direction, or %NULL
- * @ypad: (out) (allow-none): location to store padding in the Y
- * direction, or %NULL
- *
- * Gets the padding in the X and Y directions of the widget.
- * See gtk_misc_set_padding().
- **/
-void
-gtk_misc_get_padding (GtkMisc *misc,
- gint *xpad,
- gint *ypad)
-{
- GtkMiscPrivate *priv;
-
- g_return_if_fail (GTK_IS_MISC (misc));
-
- priv = misc->priv;
-
- if (xpad)
- *xpad = priv->xpad;
- if (ypad)
- *ypad = priv->ypad;
-}
-
-static void
-gtk_misc_realize (GtkWidget *widget)
-{
- GtkAllocation allocation;
- GdkWindow *window;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- gtk_widget_set_realized (widget, TRUE);
-
- if (!gtk_widget_get_has_window (widget))
- {
- window = gtk_widget_get_parent_window (widget);
- gtk_widget_set_window (widget, window);
- g_object_ref (window);
- }
- else
- {
- gtk_widget_get_allocation (widget, &allocation);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = allocation.x;
- attributes.y = allocation.y;
- attributes.width = allocation.width;
- attributes.height = allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-
- window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gtk_widget_set_window (widget, window);
- gtk_widget_register_window (widget, window);
- gdk_window_set_background_pattern (window, NULL);
- }
-}
-
-/* Semi-private function used by gtk widgets inheriting from
- * GtkMisc that takes into account both css padding and border
- * and the padding specified with the GtkMisc properties.
- */
-void
-_gtk_misc_get_padding_and_border (GtkMisc *misc,
- GtkBorder *border)
-{
- GtkStyleContext *context;
- GtkStateFlags state;
- GtkBorder tmp;
- gint xpad, ypad;
-
- g_return_if_fail (GTK_IS_MISC (misc));
-
- context = gtk_widget_get_style_context (GTK_WIDGET (misc));
- state = gtk_widget_get_state_flags (GTK_WIDGET (misc));
-
- gtk_style_context_get_padding (context, state, border);
-
- gtk_misc_get_padding (misc, &xpad, &ypad);
- border->top += ypad;
- border->left += xpad;
- border->bottom += ypad;
- border->right += xpad;
-
- gtk_style_context_get_border (context, state, &tmp);
- border->top += tmp.top;
- border->right += tmp.right;
- border->bottom += tmp.bottom;
- border->left += tmp.left;
-}
-
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GTK_MISC_H__
-#define __GTK_MISC_H__
-
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#include <gtk/gtkwidget.h>
-
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_MISC (gtk_misc_get_type ())
-#define GTK_MISC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MISC, GtkMisc))
-#define GTK_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MISC, GtkMiscClass))
-#define GTK_IS_MISC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MISC))
-#define GTK_IS_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MISC))
-#define GTK_MISC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MISC, GtkMiscClass))
-
-
-typedef struct _GtkMisc GtkMisc;
-typedef struct _GtkMiscPrivate GtkMiscPrivate;
-typedef struct _GtkMiscClass GtkMiscClass;
-
-struct _GtkMisc
-{
- GtkWidget widget;
-
- /*< private >*/
- GtkMiscPrivate *priv;
-};
-
-struct _GtkMiscClass
-{
- GtkWidgetClass parent_class;
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
-};
-
-GDK_AVAILABLE_IN_ALL
-GType gtk_misc_get_type (void) G_GNUC_CONST;
-GDK_AVAILABLE_IN_ALL
-void gtk_misc_set_alignment (GtkMisc *misc,
- gfloat xalign,
- gfloat yalign);
-GDK_AVAILABLE_IN_ALL
-void gtk_misc_get_alignment (GtkMisc *misc,
- gfloat *xalign,
- gfloat *yalign);
-GDK_AVAILABLE_IN_ALL
-void gtk_misc_set_padding (GtkMisc *misc,
- gint xpad,
- gint ypad);
-GDK_AVAILABLE_IN_ALL
-void gtk_misc_get_padding (GtkMisc *misc,
- gint *xpad,
- gint *ypad);
-
-void _gtk_misc_get_padding_and_border (GtkMisc *misc,
- GtkBorder *border);
-
-G_END_DECLS
-
-#endif /* __GTK_MISC_H__ */
if (text_orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_label_set_angle (GTK_LABEL (label), 0);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_misc_set_alignment (GTK_MISC (label),
gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)),
0.5);
+G_GNUC_END_IGNORE_DEPRECATIONS
}
else
{
gtk_label_set_angle (GTK_LABEL (label), -90);
else
gtk_label_set_angle (GTK_LABEL (label), 90);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_misc_set_alignment (GTK_MISC (label),
0.5,
1 - gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)));
+G_GNUC_END_IGNORE_DEPRECATIONS
}
}
}
gtk_widget_show (icon);
}
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GTK_IS_MISC (icon) && text_orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_misc_set_alignment (GTK_MISC (icon),
1.0 - gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)),
gtk_misc_set_alignment (GTK_MISC (icon),
0.5,
gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)));
+G_GNUC_END_IGNORE_DEPRECATIONS
if (icon)
{